package com.sfx.controller;

import com.sfx.service.UserService;
import org.springframework.stereotype.Controller;

import javax.annotation.Resource;


@Controller
public class UserController2 {
    private UserService userService;
    //Resource实现对象注入
    //实现属性注入
    //setter方法注入
    @Resource//JDK的一个扩展
    public void setUserService(UserService userService) {
        this.userService = userService;
    }

//    @Resource//JDK的一个扩展
//    public UserController2(UserService userService) {//--->不支持构造方法注入
//        this.userService = userService;
//    }

    public void doController(){
        userService.doUserService();
        System.out.println("do doController2!!!");
    }
}
